// Time/Date Setup.
if AMax.Time then
	if AMax.Time.HourMode == "24Hour" then
		AMax.Time.CurrentTime = os.date("%H:%M:%S")
	else
		AMax.Time.CurrentTime = os.date("%I:%M:%S%p")
	end
else
	ParseConfiguration("FIND", "AdminMax/Config.txt", "Time")
end
local date = string.Explode(string.lower(AMax.Time.DateMode), " ")
AMax.Time.CurrentDate = os.date("%".. date[1] .."/%".. date[2] .."/%".. date[3])

function AM_PlayerSay(ply, text, toall)
	for _,v in pairs(AMax.Commands) do
		Args = string.Explode(text)
		if string.find(string.lower(Args[1], string.lower(v.C))) then
			ply:ConCommand(v.CC)
		end
	end
	AMax:Log(ply:Nick() ..": ".. text, false)
end
hook.Add("PlayerSay", "AM_PlayerSay", AM_PlayerSay)

function AM_PlayerNoClip(ply)
	if AMax.NoClip == "ADMIN_ONLY" then
		if ply.AMax.Flag > 1 then
			return true
		else
			return false
		end
	elseif AMax.NoClip == "ALL" then
		return true
	elseif AMax.NoClip == "NONE" then
		return false
	else
		local ErrorSrc = {}
		ErrorSrc.File = "config.txt"
		ErrorSrc.Type = "variable not set"
		AMax:SendError(ErrorSrc)
		return false
	end
end
hook.Add("PlayerNoClip", "AM_PlayerNoClip", AM_PlayerNoClip)

function AM_ScalePlayerDamage( pl, hitgroup, dmginfo )
	if pl.AMax.GodMode == true then
		dmginfo:ScaleDamage(0)
	else
		dmginfo:ScaleDamage(1)
	end
end
hook.Add("ScalePlayerDamage", "AM_ScalePlayerDamage", AM_ScalePlayerDamage)

function AM_OnDamagedByExplosion( pl, dmginfo )
	if pl.AMax.GodMode == true then
		dmginfo:ScaleDamage(0)
	else
		dmginfo:ScaleDamage(1)
	end
end
hook.Add("OnDamagedByExplosion", "AM_OnDamagedByExplosion", AM_OnDamagedByExplosion)

function AM_Initialise()
local Users = util.KeyValuesToTable(file.Read("../settings/users.txt"))
table.insert(AMax, Users)
end
hook.Add("Initialize", "AM_Initialize", AM_Initialize)

function AM_InitialPlayerSpawn(ply)
	
end
